import cn.moukou.dictator.ServerApplication;
import cn.moukou.dictator.pojo.Student;
import com.alibaba.fastjson.JSONObject;
import org.junit.jupiter.api.Test;
import org.omg.CORBA.MARSHAL;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.HashMap;
import java.util.Map;

@SpringBootTest(classes = ServerApplication.class)
public class MapBean {

    @Test
    public void mapToBean() {
        Map<String, Object> map = new HashMap<>();
        map.put("name", "test");
        map.put("age","22");
        map.put("sex","male");
        map.put("avatar","www.baidu.com");
        map.put("classLabel","1班");
        Student st = JSONObject.parseObject(JSONObject.toJSONString(map), Student.class);
        System.out.println(st);
    }
}
